<?php
include_once "conn.php";
$echarts = [];
$sql = $db -> query("SELECT goods_type AS name,COUNT(*) AS value FROM goods
        JOIN order_goods ON goods.`goods_id` = order_goods.`goods_id`
        GROUP BY goods_type");
while ($row = $sql -> fetch_assoc()) {
    array_push($echarts,$row);
}
echo json_encode($echarts);
$db -> close();
?>